<script src="./script.js"></script>
<style src="./style.css"></style>
<template>
  <div class="app-container">

    <div class="filter-container">

      <el-input v-model="listQuery.keyword" placeholder="微信昵称" clearable style="width: 300px;" class="filter-item" @input="handleSearch" />

      <el-date-picker
        v-model="datetime"
        range-separator="至"
        start-placeholder="到账开始时间"
        end-placeholder="到账结束时间"
        type="daterange"
        :picker-options="pickerOptions"
        :default-time="['00:00:00']"
        value-format="yyyy-MM-dd"
        class="filter-item"
        @change="handleSearch"
      />

      <el-button class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-search" @click="handleSearch">查询</el-button>

    </div>

    <el-table
      v-loading="listLoading"
      :data="list"
      border
      fit
      highlight-current-row
      size="mini"
      :show-summary="statistics != null"
      :summary-method="getSummaries"
      style="width: 100%;"
    >
      <el-table-column label="充值编号" size="mini" prop="id" align="center" width="120">
        <template slot-scope="{row}">
          <el-link type="primary">{{ row.id }}</el-link>
        </template>
      </el-table-column>

      <el-table-column label="买家微信昵称">
        <template slot-scope="{row}">
          {{ row.nickname }}
        </template>
      </el-table-column>

      <el-table-column label="充值金额" width="100" prop="price" />

      <el-table-column label="充值类型" width="100" prop="name">
        <template slot-scope="{row}">
          <el-link type="primary" v-if="row.name == '季度会员'">{{ row.name }}</el-link>
          <el-link type="danger" v-if="row.name == '年度会员'">{{ row.name }}</el-link>
        </template>
      </el-table-column>

      <el-table-column label="返劵数量" width="100" prop="coupon_count" />

      <el-table-column label="单张金额" width="100" prop="coupon_amount" />

      <el-table-column label="优惠金额" width="100" prop="total_coupon_amount" />

      <el-table-column label="创建时间" align="center">
        <template slot-scope="{row}">
          {{ row.created_at | parseTime('{y}年{m}月{d}日 {h}:{i}:{s}') }}
        </template>
      </el-table-column>

      <el-table-column label="到账时间" align="center">
        <template slot-scope="{row}">
          {{ row.paid_at | parseTime('{y}年{m}月{d}日 {h}:{i}:{s}') }}
        </template>
      </el-table-column>

    </el-table>

    <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />

  </div>
</template>
